<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <button @click="list.push(999)">添加</button>
        <button @click="list.pop()">删除</button>
        <button @click="list[0].name = 'jack999'">改下标0的name</button>
        <p>{{ list }}</p>
    </div>
    <script src="./vue.js"></script>
    <script>
        new Vue({
            el: "#app",
            data() {
                return {
                   list: [
                    { name: 'jack', age: 16},
                    { name: 'rose', age: 15},
                   ]
                }
            },
            watch: {
                // list () {
                //     console.log('数组有变化了')
                // }
                list: {
                    deep: true,
                    handler () {
                        console.log('数组有变化了')
                    }
                }
            }
        })
    </script>
</body>
</html>